.message {
  display: flex;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.message.message-user {
  flex-direction: row-reverse;
}

.message.message-user .content {
  align-items: flex-end;
}

.message.message-user .content .text-container {
  position: relative;
}

.message.message-user .content .text-container .text {
  background: #f0f7ff;
  color: #333;
  border-radius: 1rem 1rem 0 1rem;
}

.message.message-user .content .text-container .user-copy-button {
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.message.message-user .content .text-container .user-copy-button .copy-icon {
  width: 16px;
  height: 16px;
  color: #666;
}

.message.message-user .content .text-container .user-copy-button .copy-icon.copied {
  color: #4ade80;
}

.message.message-user .content .text-container:hover .user-copy-button {
  opacity: 1;
}

.message.message-user .content .message-footer {
  flex-direction: row-reverse;
}

.message .avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.message .avatar .icon {
  width: 100%;
  height: 100%;
  color: #666;
  padding: 4px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.message .avatar .icon.assistant {
  color: #333;
  background: #f0f0f0;
}

.message .avatar .icon.assistant:hover {
  background: #e0e0e0;
  transform: scale(1.05);
}

.message .content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 80%;
}

.message .content .text-container {
  position: relative;
}

.message .content .message-footer {
  display: flex;
  align-items: center;
  margin-top: 0.25rem;
}

.message .content .message-footer .time {
  font-size: 0.75rem;
  color: #666;
}

.message .content .message-footer .copy-button {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: transparent;
  border: none;
  font-size: 0.75rem;
  color: #666;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  margin-right: auto;
  transition: background-color 0.2s;
}

.message .content .message-footer .copy-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.message .content .message-footer .copy-button .copy-icon {
  width: 14px;
  height: 14px;
}

.message .content .message-footer .copy-button .copy-icon.copied {
  color: #4ade80;
}

.message .content .message-footer .copy-button .copy-text {
  font-size: 0.75rem;
}

.message .content .text {
  padding: 1rem;
  border-radius: 1rem 1rem 1rem 0;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-color);
}

.message .content .text .cursor {
  animation: blink 1s infinite;
}

.message .content .text :deep(.think-block) {
  position: relative;
  padding: 0.75rem 1rem 0.75rem 1.5rem;
  margin: 0.5rem 0;
  color: #666;
  font-style: italic;
  border-left: 4px solid #ddd;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 0 0.5rem 0.5rem 0;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.message .content .text :deep(.think-block)::before {
  content: '思考';
  position: absolute;
  top: -0.75rem;
  left: 1rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  background: #f5f5f5;
  border-radius: 0.25rem;
  color: #999;
  font-style: normal;
}

.message .content .text :deep(.think-block):not(:first-child) {
  animation: slideIn 0.3s ease forwards;
}

.message .content .text :deep(pre) {
  background: #f6f8fa;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
  border: 1px solid #e1e4e8;
}

.message .content .text :deep(pre) code {
  background: transparent;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  tab-size: 2;
}

.message .content .text :deep(.hljs) {
  color: #24292e;
  background: transparent;
}

.message .content .text :deep(.hljs-keyword) {
  color: #d73a49;
}

.message .content .text :deep(.hljs-built_in) {
  color: #005cc5;
}

.message .content .text :deep(.hljs-type) {
  color: #6f42c1;
}

.message .content .text :deep(.hljs-literal) {
  color: #005cc5;
}

.message .content .text :deep(.hljs-number) {
  color: #005cc5;
}

.message .content .text :deep(.hljs-regexp) {
  color: #032f62;
}

.message .content .text :deep(.hljs-string) {
  color: #032f62;
}

.message .content .text :deep(.hljs-subst) {
  color: #24292e;
}

.message .content .text :deep(.hljs-symbol) {
  color: #e36209;
}

.message .content .text :deep(.hljs-class) {
  color: #6f42c1;
}

.message .content .text :deep(.hljs-function) {
  color: #6f42c1;
}

.message .content .text :deep(.hljs-title) {
  color: #6f42c1;
}

.message .content .text :deep(.hljs-params) {
  color: #24292e;
}

.message .content .text :deep(.hljs-comment) {
  color: #6a737d;
}

.message .content .text :deep(.hljs-doctag) {
  color: #d73a49;
}

.message .content .text :deep(.hljs-meta) {
  color: #6a737d;
}

.message .content .text :deep(.hljs-section) {
  color: #005cc5;
}

.message .content .text :deep(.hljs-name) {
  color: #22863a;
}

.message .content .text :deep(.hljs-attribute) {
  color: #005cc5;
}

.message .content .text :deep(.hljs-variable) {
  color: #e36209;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.dark .message .avatar .icon.assistant {
  color: #fff;
  background: #444;
}

.dark .message .avatar .icon.assistant:hover {
  background: #555;
}

.dark .message.message-user .content .text-container .text {
  background: #1a365d;
  color: #fff;
}

.dark .message.message-user .content .text-container .user-copy-button .copy-icon {
  color: #999;
}

.dark .message.message-user .content .text-container .user-copy-button .copy-icon.copied {
  color: #4ade80;
}

.dark .message .content .message-footer .time {
  color: #999;
}

.dark .message .content .message-footer .copy-button {
  color: #999;
}

.dark .message .content .message-footer .copy-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dark .message .content .text :deep(.think-block) {
  background-color: rgba(255, 255, 255, 0.03);
  border-left-color: #666;
  color: #999;
}

.dark .message .content .text :deep(.think-block)::before {
  background: #2a2a2a;
  color: #888;
}

.dark .message .content .text :deep(pre) {
  background: #161b22;
  border-color: #30363d;
}

.dark .message .content .text :deep(pre) code {
  color: #c9d1d9;
}

.dark .message .content .text :deep(.hljs) {
  color: #c9d1d9;
  background: transparent;
}

.dark .message .content .text :deep(.hljs-keyword) {
  color: #ff7b72;
}

.dark .message .content .text :deep(.hljs-built_in) {
  color: #79c0ff;
}

.dark .message .content .text :deep(.hljs-type) {
  color: #ff7b72;
}

.dark .message .content .text :deep(.hljs-literal) {
  color: #79c0ff;
}

.dark .message .content .text :deep(.hljs-number) {
  color: #79c0ff;
}

.dark .message .content .text :deep(.hljs-regexp) {
  color: #a5d6ff;
}

.dark .message .content .text :deep(.hljs-string) {
  color: #a5d6ff;
}

.dark .message .content .text :deep(.hljs-subst) {
  color: #c9d1d9;
}

.dark .message .content .text :deep(.hljs-symbol) {
  color: #ffa657;
}

.dark .message .content .text :deep(.hljs-class) {
  color: #f2cc60;
}

.dark .message .content .text :deep(.hljs-function) {
  color: #d2a8ff;
}

.dark .message .content .text :deep(.hljs-title) {
  color: #d2a8ff;
}

.dark .message .content .text :deep(.hljs-params) {
  color: #c9d1d9;
}

.dark .message .content .text :deep(.hljs-comment) {
  color: #8b949e;
}

.dark .message .content .text :deep(.hljs-doctag) {
  color: #ff7b72;
}

.dark .message .content .text :deep(.hljs-meta) {
  color: #8b949e;
}

.dark .message .content .text :deep(.hljs-section) {
  color: #79c0ff;
}

.dark .message .content .text :deep(.hljs-name) {
  color: #7ee787;
}

.dark .message .content .text :deep(.hljs-attribute) {
  color: #79c0ff;
}

.dark .message .content .text :deep(.hljs-variable) {
  color: #ffa657;
}

.dark .message .content.message-user .content .text {
  background: #0066cc;
  color: white;
}

.markdown-content :deep(p) {
  margin: 0.5rem 0;
}

.markdown-content :deep(p):first-child {
  margin-top: 0;
}

.markdown-content :deep(p):last-child {
  margin-bottom: 0;
}

.markdown-content :deep(ul),
.markdown-content :deep(ol) {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.markdown-content :deep(li) {
  margin: 0.25rem 0;
}

.markdown-content :deep(code) {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: ui-monospace, monospace;
}

.markdown-content :deep(pre code) {
  background: transparent;
  padding: 0;
}

.markdown-content :deep(table) {
  border-collapse: collapse;
  margin: 0.5rem 0;
  width: 100%;
}

.markdown-content :deep(th),
.markdown-content :deep(td) {
  border: 1px solid #ddd;
  padding: 0.5rem;
  text-align: left;
}

.markdown-content :deep(th) {
  background: rgba(0, 0, 0, 0.05);
}

.markdown-content :deep(blockquote) {
  margin: 0.5rem 0;
  padding-left: 1rem;
  border-left: 4px solid #ddd;
  color: #666;
}

.markdown-content :deep(.code-block-wrapper) {
  position: relative;
  margin: 1rem 0;
  border-radius: 6px;
  overflow: hidden;
}

.markdown-content :deep(.code-block-wrapper) .code-copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #e6e6e6;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
  z-index: 10;
}

.markdown-content :deep(.code-block-wrapper) .code-copy-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.markdown-content :deep(.code-block-wrapper) .code-copy-button .code-copy-icon {
  width: 16px;
  height: 16px;
}

.markdown-content :deep(.code-block-wrapper):hover .code-copy-button {
  opacity: 0.8;
}

.markdown-content :deep(.code-block-wrapper) pre {
  margin: 0;
  padding: 1rem;
  background: #1e1e1e;
  overflow-x: auto;
}

.markdown-content :deep(.code-block-wrapper) pre code {
  background: transparent;
  padding: 0;
  font-family: ui-monospace, monospace;
}

.markdown-content :deep(.code-block-wrapper) .copy-success-message {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(74, 222, 128, 0.9);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 20;
}

.markdown-content :deep(.code-block-wrapper) .copy-success-message.visible {
  opacity: 1;
  transform: translateY(0);
}

.dark .markdown-content :deep(.code-block-wrapper) .code-copy-button {
  background: rgba(255, 255, 255, 0.05);
}

.dark .markdown-content :deep(.code-block-wrapper) .code-copy-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.dark .markdown-content :deep(.code-block-wrapper) pre {
  background: #0d0d0d;
}

.dark .markdown-content :deep(code) {
  background: rgba(255, 255, 255, 0.1);
}

.dark .markdown-content :deep(th),
.dark .markdown-content :deep(td) {
  border-color: #444;
}

.dark .markdown-content :deep(th) {
  background: rgba(255, 255, 255, 0.1);
}

.dark .markdown-content :deep(blockquote) {
  border-left-color: #444;
  color: #999;
}